

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>快照 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/doctools.js"></script>
        <script src="../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="RBD Exclusive Locks" href="../rbd-exclusive-locks/" />
    <link rel="prev" title="Ceph 块设备运维" href="../rbd-operations/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../">Ceph 块设备</a></li>
          <li class="breadcrumb-item"><a href="../rbd-operations/">Ceph 块设备运维</a></li>
      <li class="breadcrumb-item active">快照</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../_sources/rbd/rbd-snapshot.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 块设备</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../rados-rbd-cmds/">基本命令</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../rbd-operations/">运维</a><ul class="current">
<li class="toctree-l3 current"><a class="current reference internal" href="#">快照</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#cephx">Cephx 注意事项</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id2">快照基础</a></li>
<li class="toctree-l4"><a class="reference internal" href="#layering">分层</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-exclusive-locks/">互斥锁、独占锁</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-mirroring/">镜像</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-live-migration/">实时迁移</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-persistent-read-only-cache/">永久只读缓存</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-persistent-write-log-cache/">永久写日志缓存</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-encryption/">加密</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-config-ref/">配置选项 (librbd)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-replay/">RBD 重放</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../rbd-integrations/">对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../man/">手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="id1">
<h1>快照<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h1>
<p id="index-0">一份快照是某映像在一个特定时间点（一个 checkpoint ）的一份只读的逻辑副本。
Ceph 块设备的一个高级功能就是你可以为映像创建一系列快照来保留其在不同时间点的状态历史；
Ceph 还支持分层快照，让你快速、容易地克隆映像（如 VM 映像）。
Ceph 块设备的快照功能可以用 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 命令和多个高级接口来管理，
包括 <a class="reference external" href="../qemu-rbd/">QEMU</a> 、 <a class="reference external" href="../libvirt/">libvirt</a> 、 <a class="reference external" href="../rbd-openstack/">OpenStack</a> 和 <a class="reference external" href="../rbd-cloudstack/">CloudStack</a> 。</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>要使用 RBD 快照功能，你必须有个运行着的集群。</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>因为 RBD 并不知晓映像（卷）内的文件系统，
如果没有在挂载着（捆绑着）它的操作系统内协调的话，
快照就不是<cite>崩溃一致（ crash-consistent）</cite>的。
故此，我们建议在拍快照前先暂停或停止这个映像上的 <cite>I/O</cite> 操作。</p>
<p>如果这个卷包含文件系统，在拍快照前这个文件系统内部必须处于一致状态。
在不一致的点拍下的快照需要完成 <cite>fsck</cite> 之后才能挂载。
可以用 <cite>fsfreeze</cite> 命令中止 <cite>I/O</cite> ，
命令细节请参考 <cite>fsfreeze(8)</cite> 手册页。</p>
<p>对于虚拟机， <cite>qemu-guest-agent</cite> 可在创建快照时自动冻结文件系统。</p>
</div>
<p class="ditaa">
<img src="../../_images/ditaa-f2d65d2201429779e7f366f6fc9bddb79346e3cc.png"/>
</p>
<section id="cephx">
<h2>Cephx 注意事项<a class="headerlink" href="#cephx" title="Permalink to this heading"></a></h2>
<p>启用了 <a class="reference external" href="../../rados/configuration/auth-config-ref/">cephx</a> 时（默认的），你必须指定用户名或 ID 、
及其密钥环的路径，详情见<a class="reference internal" href="../../rados/operations/user-management/#user-management"><span class="std std-ref">用户管理</span></a>。
你也可以用 <code class="docutils literal notranslate"><span class="pre">CEPH_ARGS</span></code> 环境变量来避免重复输入下列参数。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "$ ";
}
</style><span class="prompt1">rbd<span class="w"> </span>--id<span class="w"> </span><span class="o">{</span>user-ID<span class="o">}</span><span class="w"> </span>--keyring<span class="w"> </span>/path/to/secret<span class="w"> </span><span class="o">[</span>commands<span class="o">]</span></span>
<span class="prompt1">rbd<span class="w"> </span>--name<span class="w"> </span><span class="o">{</span>username<span class="o">}</span><span class="w"> </span>--keyring<span class="w"> </span>/path/to/secret<span class="w"> </span><span class="o">[</span>commands<span class="o">]</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>--id<span class="w"> </span>admin<span class="w"> </span>--keyring<span class="w"> </span>/etc/ceph/ceph.keyring<span class="w"> </span><span class="o">[</span>commands<span class="o">]</span></span>
<span class="prompt1">rbd<span class="w"> </span>--name<span class="w"> </span>client.admin<span class="w"> </span>--keyring<span class="w"> </span>/etc/ceph/ceph.keyring<span class="w"> </span><span class="o">[</span>commands<span class="o">]</span></span>
</pre></div></div><div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>把用户名和密钥写入 <code class="docutils literal notranslate"><span class="pre">CEPH_ARGS</span></code> 环境变量，
省得每次手动输入。</p>
</div>
</section>
<section id="id2">
<h2>快照基础<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<p>下列过程演示了如何用 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 命令创建、罗列、和删除快照。</p>
<section id="id3">
<h3>创建快照<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h3>
<p>用 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 命令创建快照，要指定 <code class="docutils literal notranslate"><span class="pre">snap</span> <span class="pre">create</span></code> 子命令、
外加存储池名、映像名。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>create<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span>/<span class="o">{</span>image-name<span class="o">}</span>@<span class="o">{</span>snap-name<span class="o">}</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>create<span class="w"> </span>rbd/foo@snapname</span>
</pre></div></div></section>
<section id="id4">
<h3>罗列快照<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h3>
<p>要列出一映像的快照，指定存储池名和映像名。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>ls<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span>/<span class="o">{</span>image-name<span class="o">}</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>ls<span class="w"> </span>rbd/foo</span>
</pre></div></div></section>
<section id="id5">
<h3>回滚快照<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h3>
<p>要用 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 命令回滚到某一快照，指定 <code class="docutils literal notranslate"><span class="pre">snap</span> <span class="pre">rollback</span></code> 选项、
存储池名、映像名和快照名。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>rollback<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span>/<span class="o">{</span>image-name<span class="o">}</span>@<span class="o">{</span>snap-name<span class="o">}</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>rollback<span class="w"> </span>rbd/foo@snapname</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>把映像回滚到一快照的意思是，
用快照中的数据覆盖映像的当前版本，
这个回滚过程花费的时间随映像尺寸增长。
从快照<strong>克隆要快于回滚</strong>到某快照，
这也是回到先前状态的首选方法。</p>
</div>
</section>
<section id="id6">
<h3>删除快照<a class="headerlink" href="#id6" title="Permalink to this heading"></a></h3>
<p>要用 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 删除一快照，指定 <code class="docutils literal notranslate"><span class="pre">snap</span> <span class="pre">rm</span></code> 选项、存储池名、映像名和快照名。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>rm<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span>/<span class="o">{</span>image-name<span class="o">}</span>@<span class="o">{</span>snap-name<span class="o">}</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>rm<span class="w"> </span>rbd/foo@snapname</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>Ceph 的 OSD 异步地删除数据，所以删除快照后不会立即释放磁盘空间。</p>
</div>
</section>
<section id="id7">
<h3>清除快照<a class="headerlink" href="#id7" title="Permalink to this heading"></a></h3>
<p>要用 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 删除一映像的所有快照，指定 <code class="docutils literal notranslate"><span class="pre">snap</span> <span class="pre">purge</span></code> 选项和映像名。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>purge<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span>/<span class="o">{</span>image-name<span class="o">}</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>purge<span class="w"> </span>rbd/foo</span>
</pre></div></div></section>
</section>
<section id="layering">
<span id="index-1"></span><span id="id8"></span><h2>分层<a class="headerlink" href="#layering" title="Permalink to this heading"></a></h2>
<p>Ceph 支持创建某一设备快照的很多写时复制（ COW ）克隆。
分层快照使得 Ceph 块设备客户端可以很快地创建映像。
例如，你可以创建一个块设备映像，其中有 Linux VM ；
然后拍快照、保护快照，再创建任意多写时复制克隆。
快照是只读的，所以简化了克隆快照的语义——使得克隆很迅速。</p>
<p class="ditaa">
<img src="../../_images/ditaa-a3fb2fbf22cb085ab120cb30c3df2e291cad7836.png"/>
</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>这里的术语“父”和“子”意思是一个 Ceph 块设备快照（父），
和从此快照克隆出来的对应映像（子）。
这些术语对下列的命令行用法来说很重要。</p>
</div>
<p>各个克隆出来的映像（子）都存储着对父映像的引用，
这使得克隆出来的映像可以打开父映像并读取它。</p>
<p>一个快照的 COW 克隆和其它任何 Ceph 块设备映像的行为完全一样。
克隆出的映像没有特别的限制，你可以读出、写入、克隆、调整其大小，
然而快照的写时复制克隆引用了快照，
所以你克隆前<strong>必须</strong>保护它。下图描述了此过程。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Ceph 仅支持克隆格式为 “RBD format 2” 的映像
（即创建映像时没指定 <code class="docutils literal notranslate"><span class="pre">--image-format</span> <span class="pre">1</span></code> 的）。
内核客户端从 3.10 版开始支持克隆的映像。</p>
</div>
<section id="id9">
<h3>分层入门<a class="headerlink" href="#id9" title="Permalink to this heading"></a></h3>
<p>Ceph 块设备的分层是个简单的过程。你必须有个映像、必须为它创建快照、必须保护快照，执行过这些步骤后，你才能克隆快照。</p>
<p class="ditaa">
<img src="../../_images/ditaa-a6a6b1e8568f7f11905b106bd231b8d2b5337eaf.png"/>
</p>
<p>克隆出的映像包含到父快照的引用、也包含存储池 ID 、
映像 ID 和快照 ID 。包含存储池 ID 意味着你可以把一存储池内的快照克隆到别的存储池。</p>
<ol class="arabic simple">
<li><p><strong>映像模板：</strong> 块设备分层的一个常见用法是创建一个主映像及其快照，并作为模板以供克隆。
例如，一用户创建一 Linux 发行版（如 Ubuntu 12.04 ）的映像、
并为其拍快照；此用户可能会周期性地更新映像、
并创建新的快照（如在 <code class="docutils literal notranslate"><span class="pre">rbd</span> <span class="pre">snap</span> <span class="pre">create</span></code>
之后执行 <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">apt-get</span> <span class="pre">update</span></code> 、 <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">apt-get</span> <span class="pre">upgrade</span></code> 、
<code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">apt-get</span> <span class="pre">dist-upgrade</span></code> ），
当映像成熟时，用户可以克隆任意快照。</p></li>
<li><p><strong>扩展模板：</strong> 更高级的用法包括扩展映像模板，
让它包含比基础映像更多的信息。
例如，用户可以克隆一个映像（如 VM 模板）、然后安装其它软件
（如数据库、内容管理系统、分析系统等等）、然后为此扩展映像拍快照，
拍下的快照可以像基础映像一样更新。</p></li>
<li><p><strong>模板存储池：</strong> 块设备分层的一种用法是创建一存储池，
其中包含作为模板的主映像、和那些模板的快照。
然后把只读权限分给用户，这样他们就可以克隆快照了，
而无需分配此存储池内的写和执行权限。</p></li>
<li><p><strong>映像迁移/恢复：</strong> 块设备分层的一种用法是把一存储池内的数据迁移或恢复到另一存储池。</p></li>
</ol>
</section>
<section id="id10">
<h3>保护快照<a class="headerlink" href="#id10" title="Permalink to this heading"></a></h3>
<p>克隆品要访问父快照。如果哪个用户不小心删除了父快照，所有克隆品都会损坏。为防止数据丢失，<strong>必须</strong>先保护、然后再克隆快照。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>protect<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span>/<span class="o">{</span>image-name<span class="o">}</span>@<span class="o">{</span>snapshot-name<span class="o">}</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>protect<span class="w"> </span>rbd/foo@snapname</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>你删除不了受保护的快照。</p>
</div>
</section>
<section id="id11">
<h3>克隆快照<a class="headerlink" href="#id11" title="Permalink to this heading"></a></h3>
<p>要克隆快照，你得指定父存储池、映像、和快照，还有子存储池和映像名。克隆前必须先保护它。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>clone<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span>/<span class="o">{</span>parent-image-name<span class="o">}</span>@<span class="o">{</span>snap-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span>/<span class="o">{</span>child-image-name<span class="o">}</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>clone<span class="w"> </span>rbd/foo@snapname<span class="w"> </span>rbd/bar</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>你可以把一存储池中映像的快照克隆到另一存储池。
例如，你可以把一存储池中的只读映像及其快照当模板维护、
却把可写克隆置于另一存储池。</p>
</div>
</section>
<section id="id12">
<h3>取消快照保护<a class="headerlink" href="#id12" title="Permalink to this heading"></a></h3>
<p>删除快照前，必须先取消保护。另外，
你<em>不能</em>删除被克隆品引用的快照，
所以删除快照前必须先拍平此快照的各个克隆。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>unprotect<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span>/<span class="o">{</span>image-name<span class="o">}</span>@<span class="o">{</span>snapshot-name<span class="o">}</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>snap<span class="w"> </span>unprotect<span class="w"> </span>rbd/foo@snapname</span>
</pre></div></div></section>
<section id="id13">
<h3>罗列一快照的子孙<a class="headerlink" href="#id13" title="Permalink to this heading"></a></h3>
<p>用下列命令罗列一快照的子孙：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>children<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span>/<span class="o">{</span>image-name<span class="o">}</span>@<span class="o">{</span>snapshot-name<span class="o">}</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>children<span class="w"> </span>rbd/foo@snapname</span>
</pre></div></div></section>
<section id="id14">
<h3>拍平克隆品映像<a class="headerlink" href="#id14" title="Permalink to this heading"></a></h3>
<p>克隆来的映像仍保留了父快照的引用。
要从子克隆删除这些到父快照的引用，
你可以把快照的信息复制给子克隆，也就是“拍平”它。
拍平克隆品的时间因快照尺寸而不同。
要删除快照，必须先拍平子映像。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>flatten<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span>/<span class="o">{</span>image-name<span class="o">}</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">rbd<span class="w"> </span>flatten<span class="w"> </span>rbd/bar</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>因为拍平的映像包含了快照的所有信息，所以拍平的映像占用的存储空间会比分层克隆品大。</p>
</div>
</section>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../rbd-operations/" class="btn btn-neutral float-left" title="Ceph 块设备运维" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../rbd-exclusive-locks/" class="btn btn-neutral float-right" title="RBD Exclusive Locks" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>